package com.utils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.util.CollectionUtils;

/**
 * 
 * @author SWP 
 * @date 2016年11月4日 下午2:10:42
 */
public class InitUseData {
	
	/**
	 * 初始化组织信息
	 * @return
	 */
	public static synchronized List<Map<String,String>> initOrgInfo(){
		if(CollectionUtils.isEmpty(ContanUtils.ORG_INFO_)){
			Connection conn = null;
			try {
				 conn = DBUtils.getConnection();
				 String sql="SELECT * "
				 		  + "  FROM t0014_sys_organization t "
				 		  + " WHERE t.C0014_ENABLED_STATE = '0' "
				 		  + "   AND t.C0014_DELSIGN = '0' ";
				 
				 ContanUtils.ORG_INFO_.addAll(DBUtils.findModeResult(conn, sql, null));
			} catch (Exception e) {
				e.printStackTrace();
			}finally{
				try {
					DBUtils.closeConn(null, null, conn);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
		return ContanUtils.ORG_INFO_;
	}
}
